//
//  YCButton.m
//  货运代码
//
//  Created by 刘胤辰 on 16/5/6.
//  Copyright © 2016年 温泉. All rights reserved.
//

#import "YCButton.h"

@implementation YCButton

+(instancetype)initWithFrame:(CGRect)frame Title:(NSString *)title titleState:(UIControlState)state ImageName:(NSString *)ImageName HighlightedImage:(NSString *)HighlightedImage addTarget:(nullable id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents{
    UIButton *btn=[[UIButton alloc]initWithFrame:frame];
    if (target) {
        
        [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    }
    if (title) {
        
        [btn setTitle:title forState:state];
    }
    if (ImageName) {
        
        [btn setBackgroundImage:[UIImage imageNamed:ImageName] forState:UIControlStateNormal];
    }
    if (HighlightedImage) {
        
        [btn setBackgroundImage:[UIImage imageNamed:HighlightedImage] forState:UIControlStateHighlighted];
    }
    return btn;
}

@end
